//=======================================================================================
// GameTimer.h by Frank Luna (C) 2008 All Rights Reserved.
//=======================================================================================
#pragma once
#include "SDL.h"
class SDLTimer
{
#pragma region SINGLETON
public:
	static SDLTimer* GetInstance()
	{
		if(instance == nullptr)
		{
			instance = new SDLTimer();
		}
		return instance;
	}
	static void Kill()
	{
		delete instance;
		instance = nullptr;
	}
private:
	static SDLTimer* instance;

	SDLTimer();
	SDLTimer(const SDLTimer& r);
	~SDLTimer(){}

	SDLTimer& operator=(const SDLTimer& r);
#pragma endregion
public:
	// in seconds
    float GetGameTime()const;  
    float GetDeltaTime()const;

	// Call before message loop.
    void Reset(); 
	// Call when unpaused.
    void Start();
	// Call when paused.
    void Stop();
	// Call every frame.
    void Tick();  

private:
    double mSecondsPerCount;
    double mDeltaTime;

    __int64 mBaseTime;
    __int64 mPausedTime;
    __int64 mStopTime;
    __int64 mPrevTime;
    __int64 mCurrTime;

    bool mStopped;
};
